function [f,h_s] = gabortest2(img, b, lambda, psi, gamma, verbose)
if nargin < 6
    verbose = 0;
end
if nargin < 5
    gamma = 1;
end
if nargin < 4
    psi = 0;
end
if nargin < 3
    lambda = 8;
end
S = 6;
K = 8;
a = 2^0.5;

h = cell(S, K);
miu_s = nan(S,K);
sigma_s = nan(S,K);
h_s = cell(S,K);
sigma = 1/pi*((log(2)/2)^0.5)*(2^b+1)/(2^b-1)*lambda;

g = gabor_fn2(a, S, K, sigma, lambda, psi, gamma);
img = double(img);

for m =1:S
    for n=1:K
        h{m,n} = filter2(conj(g{m,n}),img, 'valid');
        A = abs(h{m,n});
        miu_s(m,n)=mean(A(:));
        sigma_s(m,n)=std(A(:));
%        h_s{m,n}=hist(A(:),16)/numel(A);
        if verbose
            imshow(real(g{m,n}),[]);
            pause();
%            imshow(A,[]);
%           pause();
        end
        %minmax(A(:)')
    end
end
f = [miu_s(:)' sigma_s(:)'];
end